How it works is manifest.json lets you create as many command presets as you want. Here we named a present "open-sidepanel" and defined shortcuts for platforms (options are `windows`, `mac`, `chromeos`, and `linux`). Background.js listens for a command event (upon user pressing the correct shortcut keys for any command preset), then you check which command name is associated with the event, and then you query for the tabs in the current window, and then the first tab (or any tab) is selected for which you extract the window id to open the side panel with (you pass window id into the method that opens the side panel). manifest.json: ``` { "manifest_version": 3, "name": "", "version": "1.0", "description": ".", "author": "Weng Fei Fung", "icons": { "16": "icon16x16.png", "32": "icon32x32.png", "48": "icon48x48.png", "128": "icon128x128.png" }, "content_security_policy": { "extension_pages": "default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self'; object-src 'self';" }, "permissions": [ "sidePanel", "storage", "scripting", "tabs", "activeTab" ], "action": { "default_icon": "icon.png" }, "background": { "service_worker": "background.js" }, "side_panel": { "default_path": "sidepanel.html" }, "commands": { "open-sidepanel": { "suggested_key": { "default": "Ctrl+Shift+S", "mac": "Command+Shift+S" }, "description": "Open side panel." } } } ``` ^Notice the "sidePanel" as a permission. Otherwise, side panel api would not be available for you to programmatically open the side panel. sidepanel.hml: ``` Options

Side Panel

``` background.js: ``` console.log("Background script loaded"); chrome.commands.onCommand.addListener((command) => { console.log(`Command: ${command}`); if (command === "open-sidepanel") { // Get the active tab and change background to green chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) { const tab = tabs[0]; if (tabs[0]) { chrome.sidePanel.open({ windowId: tab.windowId }); } }); } }); ``` Install the chrome extension. Test that the shortcut keys "Ctrl+Shift+S" or "Command+Shift+S" works.